<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>上传视频</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<%-- <script type="text/javascript" src="../js/customize.js"></script>
        <link rel="stylesheet" type="text/css" href="../css/customize.css">
        <script type="text/javascript" src="<%=basePath%>jquery-easyui-1.3.5/jquery.min.js"></script>
        <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/jwplayer.js"></script> --%>
		<link rel="stylesheet" href="<%=basePath%>css/jquery.plupload.queue.css" type="text/css"></link>
		<script type="text/javascript" src="<%=basePath%>js/jquery-1.8.3.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/plupload/plupload.full.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/plupload/jquery.plupload.queue.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/plupload/zh-CN.js"></script>
<script type="text/javascript">


	$(function() {
		$("#uploader").pluploadQueue({
			runtimes : 'html5,flash',//设置运行环境，会按设置的顺序，可以选择的值有html5,gears,flash,silverlight,browserplus,html4
			flash_swf_url : '${pageContext.request.contextPath}/js/plupload/plupload.flash.swf',// Flash环境路径设置
			silverlight_xap_url : '${pageContext.request.contextPath}/js/plupload/plupload.silverlight.xap',//silverlight环境路径设置
			url : '${pageContext.request.contextPath}/UploadServlet',//上传文件路径Upload_UploadVideoAction
			max_file_size : '3gb',//100b, 10kb, 10mb, 1gb
			chunk_size : '1mb',//分块大小，小于这个大小的不分块
			unique_names : true,//生成唯一文件名
			// 如果可能的话，压缩图片大小
			// resize : { width : 320, height : 240, quality : 90 },
			// 指定要浏览的文件类型
			filters : [ {
				title : 'Image files',
				extensions : 'jpg,gif,png'
			}, {
				title : 'Video files',
				extensions : 'avi,flv,mp4,rm,rmvb,mkv,mov'
			}],
			init : {
				FileUploaded : function(up, file, info) {//文件上传完毕触发
					console.info(up);
					console.info(file);
					console.info(info);
					var response = $.parseJSON(info.response);
					if (response.status) {
						$('#f1').append('<input type="hidden" name="fileUrl" value="'+response.fileUrl+'"/>');
						$('#f1').append('<input type="hidden" name="fileName" value="'+file.name+'"/><br/>');
						$('#f1').append('<input type="hidden" name="realName" value="'+response.realName+'"/>');
					}
				}
			}
		
		});

		// 客户端表单验证
		$('form').submit(function(e) {
			var uploader = $('#uploader').pluploadQueue();
			if (uploader.files.length > 0) {// 判断队列中是否有文件需要上传
				uploader.bind('StateChanged', function() {// 在所有的文件上传完毕时，提交表单
					if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
						$('form')[0].submit();
					}
				});
				uploader.start();
			} else {
				alert('请选择至少一个文件进行上传！');
			}
			return false;
		});

	});
</script>

<style type="text/css">
<!--

.rightcase{
	width:70%;
	min-height:600px;
	padding:1%;
	background-color:#ffffff;
	margin:5% auto;
	border:1px solid #d9d9d9;
	box-shadow:0 1px 0,0 5px 5px rgba(0,0,0,0.7);
	border-radius:6px 6px 6px 6px;
}
.title{
	height:5%;
	padding-top:2%;
	text-align:center;
	font-size:16pt;
	font-family:微软雅黑;
	color:#000000;
	font-weight:normal;
}

.uploadbutton{
	width:50%;
	margin-top:20px;
	margin-left:25%;
}

 div#upload a:link {color:#000000;text-decoration:none;font-size:14pt;} /* 未访问的链接 */
 div#upload a:visited {color:#000000;text-decoration:none;font-size:14pt;} /* 已访问的链接 */
 div#upload a:hover {color:#ffffff;font-size:14pt;} /* 鼠标移动到链接上 */
 div#upload a:active {color: #ffffff;font-size:14pt;} /* 选定的链接 */


body{
	background-image:url('<%=basePath%>images/background4.jpg');
	background-repeat:no-repeat;
}
-->
</style>



</head>
<body>
      <jsp:include page="../head.jsp"></jsp:include>
      
    <div class="rightcase">
    	<div class="title">上传视频</div>
	 	<hr size="3px" color="#F2DAB5">
    
	<form id="f1" action="<%=basePath%>Media_uploadVideosAction?userid=${temploginbean.userId}&usertype=${temploginbean.userType}" method="post">

					<div id="uploader">您的浏览器没有安装Flash插件，或不支持HTML5！</div>
					<!-- 
					<button onclick="$('#uploader').pluploadQueue().start();">开始上传</button>
					<button onclick="$('#uploader').pluploadQueue().stop();">停止上传</button>
					 -->

		<button class="uploadbutton" type="submit">上传完毕</button>
	</form>
	

	</div>
	
	
  </div>  
    <%@ include file="../foot.jsp"%>
  </div>

</body>
</html>